<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definitions" 
  xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
  xmlns:camunda="http://camunda.org/schema/1.0/bpmn"
  targetNamespace="Examples">
  
  <error id="myError" errorCode="23" />
  <error id="myException" errorCode="org.camunda.bpm.engine.test.bpmn.event.error.MyBusinessException" />
  
  <process id="catchErrorThrownByJavaDelegateOnEmbeddedSubProcess" isExecutable="true">
  
    <startEvent id="theStart" />
    <sequenceFlow id="flow1" sourceRef="theStart" targetRef="subProcess" />
    
    <subProcess id="subProcess">
      <startEvent id="subProcessStart"/>
      <sequenceFlow id="flow2" sourceRef="subProcessStart" targetRef="serviceTask" />
	    <serviceTask id="serviceTask" camunda:class="org.camunda.bpm.engine.test.bpmn.event.error.ThrowBpmnErrorDelegate" />
    </subProcess>
    
    <boundaryEvent id="catchError" attachedToRef="subProcess">
      <errorEventDefinition errorRef="myError"/>
    </boundaryEvent>
    
    <boundaryEvent id="catchException" attachedToRef="subProcess">
      <errorEventDefinition errorRef="myException"/>
    </boundaryEvent>
    
    <sequenceFlow id="flow3" sourceRef="catchError" targetRef="escalatedTask" />
    
    <sequenceFlow id="flow4" sourceRef="catchException" targetRef="escalatedExceptionTask" />
    
    <userTask id="escalatedTask" name="Escalated Task" />
    
    <userTask id="escalatedExceptionTask" name="Escalated Exception Task" />
    
    <sequenceFlow id="flow5" sourceRef="subProcess" targetRef="theEnd" />
    
    <endEvent id="theEnd" />
    
  </process>

</definitions>